<template>
    <div class="container">
        <h3>仓库管理</h3>
        <el-row style="margin-top: 20px">

            <el-button  type="primary" @click="goadd" style="float: right; margin-right: 10px">新增仓库</el-button>
        </el-row>

        <el-table :data="tableData" border ref="multipleTable" header-cell-class-name="table-header" style="margin-top: 20px">
            <el-table-column prop="name" sortable label="仓库名称"></el-table-column>
           <el-table-column prop="address" sortable label="仓库地址"></el-table-column>
		   <el-table-column prop="clientName" sortable label="仓库管理"></el-table-column>
		   <el-table-column prop="area" sortable label="仓库面积">
			   <template slot-scope="scope">
				   <div>{{scope.row.area}}亩</div>
			   </template>
		   </el-table-column>
		   <el-table-column prop="airPositions" sortable label="气调仓位数"></el-table-column>
		   <el-table-column prop="airVolume" sortable label="气调仓位容量">
			   <template slot-scope="scope">
				   <div>{{scope.row.area}}kg</div>
			   </template>
		   </el-table-column>
		   <el-table-column prop="dryPositions" sortable label="干仓位数"></el-table-column>
		   <el-table-column prop="dryVolume" sortable label="干仓位容量">
			   <template slot-scope="scope">
				   <div>{{scope.row.area}}kg</div>
			   </template>
		   </el-table-column>
            <el-table-column label="操作" width="150" align="center">
                <template slot-scope="scope">
					<el-button type="text"  @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
                </template>
            </el-table-column>
        </el-table>
        <el-pagination
            layout="total, prev, pager, next, jumper"
            :page-size="pagesize"
            :current-page.sync="currentPage"
            @current-change="handleCurrentChange"
            :total="total"
            style="margin-top: 20px"
        ></el-pagination>
    </div>
</template>

<script>
import axios from "axios"
import { CodeToText } from 'element-china-area-data';
export default {
    data() {
        return {
            searchName: '',
            tableData: [],
            currentPage: 1,
            pagesize: 10,
            total: 0,
            added: true,
            edit: true,
            check: true,
            del: true,
            action: ''
        };
    },
    created() {},
    mounted() {
        this.init();

    },
    methods: {

        init() {
            // var companyId = localStorage.getItem("companyId")
            let data = {
                page: this.currentPage,
				// companyId:companyId
            };
           axios.post("https://bbgy.cpzsyun.com:82/api/control/storeHouse/findList",data).then((res)=>{
				this.tableData = res.data.rows
				this.total = res.data.total
           })
        },

        goadd() {
            this.$router.push({
                path: '/editmessage/added'
            });
        },

        handleCurrentChange(val) {
            this.currentPage = val;
            this.init();
        },

        //跳转编辑页面
        handleEdit(index, row) {
            this.$router.push({
                path: '/editmessage/added',
                query: { id: row.id }
            });
        },
    }
};
</script>

<style scoped lang="less">
/deep/.upload-daoru {
    background: #eee;
    .el-upload {
        border: none;
        width: auto;
        height: auto;
        border-radius: 0;
        float: right;
        margin-right: 10px;
    }
}
/* .el-row{ margin-bottom: 20px;} */
.el-pagination {
    text-align: center;
}
/* .el-select .el-input {
width: 130px;
} */
.input-with-select .el-input-group__prepend {
    background-color: #fff;
}
.el-input--small .el-input__inner {
    border-radius: 5px 0 0 5px !important;
    /* border-right: none; */
}
.el-col {
    margin-bottom: 0;
}
</style>
